Support MDX docs from manifests#120
Conversation
🦋 Changeset detectedLatest commit: 861b5a4 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR 💥 An error occurred when fetching the changed packages and changesets in this PR |
…t-docs-manifest-entries
commit: |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #120 +/- ##
==========================================
+ Coverage 87.82% 88.70% +0.88%
==========================================
Files 19 21 +2
Lines 427 478 +51
Branches 122 134 +12
==========================================
+ Hits 375 424 +49
- Misses 8 9 +1
- Partials 44 45 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Pull request overview
This PR adds support for MDX-based documentation entries in component manifests, allowing Storybook's addon-docs to provide standalone and component-attached documentation via the MCP protocol. The changes include breaking renames of tool functions and handlers to reflect the broader scope beyond just components.
Key changes:
- Adds
DocsManifestMaptype and parallel fetching of both component and docs manifests - Renames tools from
list-all-components/get-component-documentationtolist-all-documentation/get-documentation - Implements
extractDocsSummaryutility to parse MDX content for list previews - Updates all formatters (XML/Markdown) to support docs entries
Reviewed changes
Copilot reviewed 49 out of 50 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml, pnpm-lock.yaml | Updates Storybook dependencies to 10.2.0-alpha.10 to support new manifest features |
| packages/mcp/src/types.ts | Adds Doc, DocsManifestMap, AllManifests types; renames handlers from onListAllComponents/onGetComponentDocumentation to onListAllDocumentation/onGetDocumentation |
| packages/mcp/src/utils/get-manifest.ts | Refactors getManifest → getManifests to fetch both component and docs manifests in parallel; splits MANIFEST_PATH into COMPONENT_MANIFEST_PATH and DOCS_MANIFEST_PATH |
| packages/mcp/src/utils/manifest-formatter/*.ts | Adds formatDocsManifest and extractDocsSummary; renames formatComponentManifestMapToList → formatManifestsToLists to handle both manifest types |
| packages/mcp/src/tools/*.ts | Renames list-all-components → list-all-documentation and get-component-documentation → get-documentation; updates to handle both component and docs entries |
| packages/mcp/src/index.ts | Updates exports to reflect renamed functions and constants |
| packages/mcp/fixtures/small-docs-manifest.fixture.json | Adds test fixture for docs manifest |
| packages/mcp/bin.ts | Updates CLI args from --manifestPath to --componentManifestPath and adds --docsManifestPath |
| packages/addon-mcp/src/*.ts | Updates addon to use renamed tools/handlers and check for experimental_manifests preset instead of experimental_componentManifestGenerator |
| packages/addon-mcp/src/template.html | Updates tool name in UI template |
| apps/internal-storybook/stories/*.mdx | Adds example MDX documentation files for testing |
| apps/internal-storybook/tests/*.test.ts | Updates E2E tests with new tool names and adds docs manifest validation |
| eval/**, README.md, .github/instructions/*.md | Updates documentation and configuration to reflect breaking changes |
| .changeset/*.md | Documents breaking changes for both packages |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
There was a problem hiding this comment.
The diff is "wrong" here, this is not a new file, but just the get-component-documentation renamed and changed.
| return dedent`# ${doc.title} | ||
|
|
||
| ${doc.content}`; | ||
| }, |
There was a problem hiding this comment.
The first line here might be unnecessary/redundant, adding the title? We could also just assume that MDX files always has a # title?
valentinpalkovic
left a comment
There was a problem hiding this comment.
LGTM. Left some small comments. Please clean up the pnpm-lock.yaml file. (Remove the experiments)
…n/docs.json instead of supporting custom filenames
Bundle ReportChanges will increase total bundle size by 6.68kB (14.05%) ⬆️
ℹ️ *Bundle size includes cached data from a previous commit Affected Assets, Files, and Routes:view changes for bundle: @storybook/mcp-esmAssets Changed:
view changes for bundle: @storybook/addon-mcp-esmAssets Changed:
Files in
|
Companion PR in core: storybookjs/storybook#33408
This PR adds support for the new docs entries in manifests, that addon-docs now adds based on MDX files. It's not required, so it will still support Storybooks that don't use addon-docs.
See the following tests for how this is outputted to the LLM:
Breaking Changes
This PR introduces a number of minor breaking changes to
@storybook/mcp:addGetComponentDocumentationTool->addGetDocumentationTooladdListAllComponentsTool->addListAllDocumentationToolonListAllComponents->onListAllDocumentationonGetComponentDocumentation->onGetDocumentationMANIFEST_PATHconstant have been removed in favor of two new constants,COMPONENT_MANIFEST_PATHandDOCS_MANIFEST_PATH